package com.oscarmovie.model;

public class Paging {
	private int totalCount;
	private int currentPage=1;
	private int pageSize;
	private int totalPage = 1;
	private int currentRow;
	
	public Paging(){
		this.pageSize = 50;
	}
	public Paging(int pageSize){
		this.pageSize = pageSize;
	}
	
	public void setCurrentPage(int currentPage) {		
		this.currentPage = currentPage;
		currentRow = (currentPage-1)*pageSize+1;
	}
	
	
	/**
	 * @param totalPage the totalPage to set
	 */
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	/**
	 * @param currentRow the currentRow to set
	 */
	public void setCurrentRow(int currentRow) {
		this.currentRow = currentRow;
	}
	public void setTotalCount(int totalCount) {		
		this.totalCount = totalCount;
		totalPage = totalCount == 0 ? 1 : (int) Math.ceil((double)totalCount/(double)pageSize);
		currentRow = (currentPage-1)*pageSize+1;
	}
	public int getCurrentPage() {
		
		return currentPage;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getTotalCount() {
		return totalCount;
	}
	
	public int getTotalPage() {
		return totalPage;
	}
	
	public int getCurrentRow() {
		return currentRow;
	}
	
	
}